-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix getVisibleElements helper in RTL-locales #12464
Fix getVisibleElements helper in RTL-locales #12464
Conversation
e1cadbe
to
abe126e
Compare
abe126e
to
8e43606
Compare
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/c4d1387ab62fd81/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/c4d1387ab62fd81/output.txt Total script time: 3.48 mins Published |
@Snuffleupagus If you have time, could you take a look at this PR? It looks reasonable to me, but my experience with the (not so trivial) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that we have unit tests for the getVisibleElements
function in test/unit/ui_utils_spec.js
. I don't know how difficult this it to test, but it would be great if you could extend the unit tests for this PR so that we prevent this from regressing again in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in #12464 (review), we need at least a basic unit-test for this (called e.g. handles horizontal scrolling with RTL-documents correctly
).
I'd suggest defining a suitable scrollEl
, similar but obviously not identical to
pdf.js/test/unit/ui_utils_spec.js
Lines 740 to 746 in 49791f5
it("handles `sortByVisibility` correctly", function () { | |
const scrollEl = { | |
scrollTop: 75, | |
scrollLeft: 0, | |
clientHeight: 750, | |
clientWidth: 1500, | |
}; |
pdf.js/test/unit/ui_utils_spec.js
Lines 730 to 736 in 49791f5
const pages = makePages([ | |
[ | |
[10, 50], | |
[20, 20], | |
[30, 10], | |
], | |
]); |
const visibleSorted = getVisibleElements(
scrollEl,
views,
/* sortByVisibility = */ true,
/* horizontal = */ true,
/* rtl = */ true
);
and then checking that visibleSorted
has the expected order (see how that's implemented in the existing test).
8e43606
to
b7b048e
Compare
I added the two suggested changes and a test |
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/305b37fbe8570e2/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/305b37fbe8570e2/output.txt Total script time: 4.07 mins Published |
/botio-linux unittest |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/b79b13490fda154/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/b79b13490fda154/output.txt Total script time: 4.30 mins
|
Thank you for fixing this! |
This PR fixes #12453. I'm not sure about the name of the auxiliary function
isElementNextAfterViewHorizontally
.